package com.vainycos.mylogback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;


/**
 * @author: Vainycos
 * @description 心跳检测
 * @date: 2021/11/22 16:33
 */
@Component
public class HeartCheckTask {

    private Logger logger = LoggerFactory.getLogger(HeartCheckTask.class);

    /**
     * 每5s执行一次消息发送
     */
    @Scheduled(cron = "0/5 * * * * ?")
    void heart(){
        String now = LocalDateTime.now().toString();
        logger.trace("trace 心跳检测->{}", now);
        logger.debug("debug 心跳检测->{}", now);
        logger.info("info   心跳检测->{}", now);
        logger.warn("warn   心跳检测->{}", now);
        logger.error("error 心跳检测->{}", now);
    }

}
